﻿using System.Configuration;
using iMobileS.Models;


namespace iMobileS.Common
{
    public class UnityObject
    {
        public static void Register()
        {
            Services.RegisterInstance<ICache>(new HttpRequestCacheResolver());
            Services.RegisterType<IDatabase>(
                c =>
                new iMobileDatabase(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString));

            Services.RegisterType<ICategoriesRepository>(c => new CategoriesRepository(
                                                               c.Resolve<IDatabase>(),
                                                               c.Resolve<ICache>()
                                                               )
                );
            //Services.RegisterType<IOrderProductsRepository>(c => new OrderProductsRepository(
            //                                                         c.Resolve<IDatabase>(),
            //                                                         c.Resolve<ICache>()
            //                                                         )
            //    );
            //Services.RegisterType<ISurveyRepository>(c => new SurveyRepository(
            //                                                  c.Resolve<IDatabase>(),
            //                                                  c.Resolve<ICache>())
            //    );
        }
    }
}